package com.abigdreamer.im.server.ui;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;

import com.abigdreamer.im.server.ui.resourse.ResourseMannager;



public class BaseFrame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private  String baseTitle="ABD-IM-企业即时通讯服务器";   //标题

	public BaseFrame(){
		this.setTitle(baseTitle);
		Image icon=ResourseMannager.getImageIcon("server.png", 16, 16).getImage();
		this.setIconImage(icon);
	}
	
	public Image  getQQIconImage(String path){
		Image image = Toolkit.getDefaultToolkit().getImage("");
		return image;
	}
	
	public static void intSubstance(){
	 	JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
        try {
            UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel());
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(BaseFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
	}
	
	public static void centerWindow(Container window) {
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		int w = window.getSize().width;
		int h = window.getSize().height;
		int x = (dim.width - w) / 2;
		int y = (dim.height - h) / 2;
		window.setLocation(x, y);
	}
	
}
